<!--Style Sheet Scripts-->    
    <link rel="stylesheet" type="text/css" href="CSS/loginpopup.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="CSS/popupstylesheet.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="CSS/style.css" media="screen" />  

<!--Secure PHP Login Scripts-->
	<script type="text/JavaScript" src="Assets/sha512.js"></script> 
    <script type="text/JavaScript" src="Assets/forms.js"></script> 

<!--js assets-->
	<script type="text/JavaScript" src="Assets/jquery.min.js"></script>
	<script type="text/JavaScript" src="Assets/popup.js"></script>
	<script type="text/JavaScript" src="Assets/jquery-1.10.1.min.js"></script>
    <script type="text/JavaScript" src="Assets/jquery-migrate-1.2.1.min.js"></script>

 <?php
 include_once 'credentials/includes/db_connect.php';
 include_once 'credentials/includes/functions.php';
 ?>
    <!--Check if already logged in-->
 <?php
    sec_session_start();
	if (login_check($mysqli) == true) 
	{
		$logged = 'in';
	} else 
	{
		$logged = 'out';
	}
  ?>
    <!--Secure Connector Script-->


    <!--Secure CSS Login Scripts-->


<!----------------------login error message for user--------->
<?php
        if (isset($_GET['error'])) {
            echo '<p class="error">Error Logging In!</p>';
        }
    
?>
<!----------------------------start login code------------------------------------>
        <table width="100%">
  <tr>
    <th scope="col">
<div class="toggler" id="effect">
	<?php if (login_check($mysqli) == true) : ?>
        <p>Welcome <?php echo htmlentities($_SESSION['email']); ?>!</p>
        <p>Logout <a href="backup/index.php">login page</a></p>
    <?php else : ?>
    <a href="#login-box" class="login-window">Login / Sign In</a>
		<div id="login-box" class="login-popup">
			<a href="#" class="close"><img src="images/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
				<form action="credentials/includes/process_login.php" method="post" name="login_form" class="signin">
					<fieldset class="textbox">
						<label class="username">
							<span>Username or email</span>
							<input name="email" type="text" autocomplete="on" placeholder="Email Address"/>
						</label>
						<label class="password">
						<span>Password</span>
							<input name="password" type="password" placeholder="Password"/>
						</label>
							<button type="button" class="submit button" onclick="formhash(this.form, this.form.password);"/>Sign in</button>
					<p><a class="forgot" href="#">Forgot your password?</a></p> 
					<p><a class="login-window" href="#Enroll-box">Need to create an account?</a></p> 
					<p>You are currently logged <?php echo $logged ?>.</p>
					</fieldset>
				</form>
          </div>
       </th>
	<th scope="col">
    
        <!----------------------------end login code------------------------------------>
        
            <!----------------------------start enrollment code------------------------------------>
<div class="toggler" id="effect">
<?php
	if (!empty($error_msg)) {
		echo $error_msg;
	}
?>
	<a href="#Enroll-box" class="login-window">Create an Account</a>
		<div id="Enroll-box" class="login-popup">
	<a href="#" class="close"><img src="images/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
		<form action="credentials/includes/register_inc.php" method="post" name="reg_form" class="signin">
		<fieldset class="textbox">
        <label class="username">
		<span style="color:black; font-size: 15pt">E-Mail/Username (The email address entered will be your username)</span>
        <table width="100%">
    <tr>
  	<th scope="col"><input id="email" name="email" value="" type="text" autocomplete="on" placeholder="Email Address"></th>
    <th scope="col"><input id="conf_email" name="reenteremail" value="" type="text" placeholder="Confirm your Email Address"></th>
	</tr>
	</table>
    </label>
 
    <label class="password">
		<span style="color:black; font-size: 15pt">Create password for your username</span>
        		<table width="100%">
    <tr>
  	<th scope="col"><input id="password" name="password" value="" type="password" placeholder="Password"></th>
    <th scope="col"><input id="conf_password" name="conf_password" value="" type="password" placeholder="Confirm your Password"></th>
	</tr>
</table>
		</label>
        		<button type="button" class="submit button" onclick="return regformhash(this.form, this.form.email, this.form.conf_email, this.form.password, this.form.conf_password);"/>Create Account</button>
<p>Emails must have a valid email format with an @ symbol</p>
<p>Passwords must be at least 6 characters long and contain the following:</p>
	<li>At least one upper case letter (A..Z)</li>
	<li>At least one lower case letter (a..z)</li>
	<li>At least one number (0..9)</li>
        		</fieldset>
			  </form>
          </div></th>
  		</tr>
		</table>
        </div>
      </div>
	<?php endif; ?>
    <!----------------------------end enrollment code------------------------------------>
